<?php
declare (strict_types = 1);

namespace app\validate;

use think\Validate;

class Page extends Validate
{
    /**
     * 定义验证规则
     * 格式：'字段名'	=>	['规则1','规则2'...]
     *
     * @var array
     */
	protected $rule = [
		  'id' => 'require|number',
			'name' => 'require|between:1,25',
			'type' => 'require|number',
			'owned_user_id' => 'require|number',
			'proplan_id' => 'require|number',
			'path' => 'require',
			'keys' => 'require',
			'url' => 'require',
			'token' => 'require',
			'proaccount_id' => 'require|number',
			//'create_time' => 'require',
			'expires_time' => 'require',
		//	'switch' => 'require|number',
		   //'promote_time' => '',
			'description' => 'max:500',
	];

    /**
     * 定义错误信息
     * 格式：'字段名.规则名'	=>	'错误信息'
     *
     * @var array
     */
    protected $message = [
				'id.require' => '必须传递id值',
				'id.number' => 'id必须为数值',
				'name.require' => '请上传name',
				'name.between' => '名字长度为1-25',
				'type.require' => '必须为page选择类型',
				'path.require' => '请选择page文件所在位置',
				'keys.require' => '密码必须加上',
				'url.require' => '请选择url路径',
				'proaccount_id.require' => '必须选择推广账户',
				'proplan_id.require' =>'必须选择推广计划',
				'expires_time.require' => '请选择过期时间',
				'owned_user_id.require' => '必须指定用户',
				'owned_user_id.number' => '所属账户id必须是数值',
				'token.require' => '请上传token值,',
				'description.max' =>  '描述的最大字符长度为500',
		];

		protected $scene=[
				'create' => [

				],

				'edit' => [

				],
				'delete' => [

				],
				'findbyname' => [

				],
		];
}
